In any optical system it is desirable for the lens to be focused to obtain an optimum image. It is often difficult for a camera operator to determine a precise lens focus position by viewing a scene through a view finder. Focus measurement techniques are often implemented to aid the camera operator to focus the lens to improve the quality of pictures. Focusing is the adjustment of the relative position of the subject, the lens, and the image plane in order to create a sharp image. The distance from lens to image plane depends on the distance from subject to lens.
Autofocus cameras are an important application of focus measurement methods. One type of autofocus system uses a form of sound ranging to bounce a sound wave off the subject. An ultra-high frequency sound emitter is used to transmit a signal and then a receiver listens for the echo. The amount of time it took for the reflected ultrasonic sound wave to reach the camera from the subject is computed and the lens position is adjusted accordingly. The use of sound has its limitations, for example, if you try to take a picture from inside a vehicle with the windows closed, the sound waves will bounce off the window instead of the subject and focus the lens incorrectly.
Another type of autofocus system uses pulsed infrared light and measures the intensity of the reflected light to judge the distance. Alternatively, the pulses of infrared light are transmitted and the subject reflects the infrared light back to the camera. The camera's microprocessor computes the time difference between the time outbound infrared light pulses are sent and the inbound pulses are received. Using the difference, the microprocessor circuit drives the focus motor a particular direction and distance. The use of infrared has its limitations, for example, a source of infrared light from the subject, for example birthday cake candles, can confuse the infrared sensor. A subject surface may absorb the outbound infrared beam. Furthermore, the infrared beam can reflect from objects in the scene that are not the subject of the photograph.
Still another type of autofocus system, sometimes referred to as passive autofocus and commonly found on single-lens reflex (SLR) autofocus cameras, determines the distance to the subject by computer analysis of the image. A typical autofocus sensor is a charge-coupled-device (CCD) that provides input to algorithms that compute the contrast of the actual picture elements. Light from the scene hits the strip of CCDs, each CCD corresponding to a pixel and the microprocessor looks at the values from each pixel. The microprocessor in the camera looks at the strip of pixels and looks at the difference in intensity among the adjacent pixels. If the scene is out of focus, the blurriness you see in the top image causes adjacent pixels to have very similar intensities. The microprocessor sends a signal to a motor that moves the lens. The microprocessor then searches for the point where there is maximum intensity difference between adjacent pixels which is the point of best focus. Passive autofocus must have light and image contrast in order to perform effectively.
A disadvantage of all of the above techniques is that they require additional hardware increasing the costs and size of the camera.